package com.baijia.authentication;

import com.baijia.common.enums.UserRoleType;

/**
 * @title APP
 * @desc Passport 支持产品线账户类型，与配置文件中appid对应
 * @author caoliang
 * @date 2015年11月10日
 * @version 1.0
 */
public enum AccountType {

    ORG(1, "机构"), ORG_SUB_ACCT(2, "机构子帐号"), ORG_TEACHER(3, "机构老师"), USER(6, "主站账号（老师和学生）"), MOBILE(8, "通过手机号登录"), PASSPORT(
        0, "Passport登录");

    private int code;
    private String name;

    AccountType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {

        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {

        return name;
    }

    public void setName(String name) {

        this.name = name;
    }

    public static AccountType getAccountTypeByCode(int code) {
        for (AccountType accountType : AccountType.values()) {
            if (accountType.getCode() == code) {
                return accountType;
            }
        }
        return null;
    }

}
